package com.briup.day03;

import java.util.Scanner;

public class Test_Bit {
    public static void main01(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入两个整数");
        int a=sc.nextInt();//10 20 0000 1010 0001 0100
        int b=sc.nextInt();
        System.out.println(a&b);//0000 0000  0
        System.out.println(a|b);//0001 1110  30
        System.out.println(a^b);//0001 1110  30
        //原-反-补-取反（补）-反-原
        System.out.println(~a);//先取反 1111 0101
                               // 反码 1111 0100
                               // 负的 0000 1011

        //1 0(23) 0000 1010
        //0 1(23) 1111 0101
    }

    public static void main02(String[] args) {
        int a=10;
        int b=20;
        //使用异或交换两个数的值
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("input two num: ");
        int a = sc.nextInt();
        int b = sc.nextInt();
        int max = (a > b) ? a : b;
        int min = (a < b) ? a : b;
        System.out.println("max: " + max);
        System.out.println("min: " + min);
    }
}
